// Web Worker for field mapping
self.onmessage = function(e) {
  const { sourceFields, targetFields } = e.data
  
  // 创建目标字段映射表
  const targetFieldMap = new Map(
    targetFields.map(field => [field.value, field])
  )
  
  // 批量创建新的映射数组
  const newMappings = sourceFields
    .filter(sourceField => targetFieldMap.has(sourceField.value))
    .map(sourceField => ({
      id: `mapping_${Date.now()}_${sourceField.value}`,
      sourceField: sourceField.value,
      targetField: sourceField.value
    }))
  
  // 发送处理结果回主线程
  self.postMessage(newMappings)
} 